
import 'dart:convert';

ProgrammeEntity programmeFromJson(String str) => ProgrammeEntity.fromJson(json.decode(str));

String programmeToJson(ProgrammeEntity data) => json.encode(data.toJson());

class ProgrammeEntity {
  int id;
  String programmeName;

  ProgrammeEntity({
    required this.id,
    required this.programmeName,
  });

  factory ProgrammeEntity.fromJson(Map<String, dynamic> json) => ProgrammeEntity(
    id: json["id"],
    programmeName: json["programmeName"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "programmeName": programmeName,
  };

  static List<Map> exchangeLabelList(List<ProgrammeEntity> entitys) {
    List<Map> list = [];
    for (ProgrammeEntity entity in entitys) {

      list.add({"label": entity.programmeName, "value": entity.id.toString()});
    }
    return list;
  }
}
